home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / OOFILE / Buildable, limited OOFILE / OOFILE headers / oof2.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-24  |  1.6 KB  |  76 lines  |  [TEXT/CWIE]

  1. #ifndef H_OOF2
  2. #define H_OOF2
  3.  
  4. // COPYRIGHT 1994 A.D. Software, All rights reserved
  5.  
  6. // backend parent layer of OOFILE database
  7.  
  8. // NOTE inline definitions included at end of this header file
  9.  
  10. #include "oof1.hpp"
  11.  
  12. // forward declarations
  13. class OOF_bit;
  14. class dbField;
  15. class dbBLOB;
  16. class dbTable;
  17.  
  18. class dbRelChain;
  19. class dbRelHalf;
  20. class dbRelRefBase;
  21. class dbRelationship;
  22. class OOF_relChainList;
  23.  
  24.  
  25. class OOF_Context 
  26. {
  27. public:
  28.     virtual ~OOF_Context() {};
  29. };
  30.  
  31.  
  32. class OOF_ExpandableLongArray {        // this would be a good candidate to template-ize
  33. public:
  34.     OOF_ExpandableLongArray(unsigned long defaultValue, unsigned long numSlots=0, unsigned int expandBySlots=4);
  35.     OOF_ExpandableLongArray(const OOF_ExpandableLongArray& rhs);
  36.     ~OOF_ExpandableLongArray();
  37.  
  38.     OOF_ExpandableLongArray& operator=(const OOF_ExpandableLongArray&);
  39.     void copyContents(const OOF_ExpandableLongArray&);
  40.     
  41. // access protocol
  42.     void append(unsigned long);
  43.     void deleteCell(unsigned long index);
  44.     void deleteAllCells();
  45.     unsigned long& operator[](unsigned long index);
  46.     unsigned long value(unsigned long index) const;
  47.     unsigned long& item(unsigned long index);
  48.  
  49.  
  50.     // iterator protocol
  51.     void start();
  52.     bool more();
  53.     void next();
  54.     unsigned long count() const;
  55.     unsigned long& operator()();
  56.  
  57. protected:
  58.     enum {kSlotSize=sizeof(unsigned long)};
  59.     void ExpandToInclude(unsigned long indexToCover);
  60.   void CreateArrayRefCount();
  61.   void DeleteBits();
  62.  
  63. // data storage
  64.     unsigned long *mBits;    // owned
  65.     unsigned long mDefaultValue;
  66.     unsigned long mNextFreeEntry, mNumSlots, mInternalIter;
  67.     unsigned int mExpansionChunk;
  68.     int* mArrayRefCount;    // owned
  69.  
  70. };
  71.  
  72.  
  73. // include inline definitions
  74. #include "oof2.inl"
  75.  
  76. #endif